// 分析文档中的标准数据格式
const standardData = {
  // 1418指令：选择区域
  "1418": {
    "areaId:100": [
      { id: 289, name: "许昌" },
      { id: 302, name: "洛阳" },
      { id: 304, name: "长安" }
    ],
    "areaId:19": [
      { id: 70, name: "成都" },
      { id: 111, name: "南中" },
      { id: 117, name: "汉中" }
    ],
    "areaId:43": [
      { id: 154, name: "建业" },
      { id: 212, name: "长沙" },
      { id: 264, name: "江陵" }
    ]
  },

  // 1436指令：获取站点信息
  "1436": {
    "pid:289": [ // 许昌子区域
      { id: 2, name: "新手村", extension: "(1级)" },
      { id: 301, name: "陈留", extension: "(5级)" },
      { id: 487, name: "九里山", extension: "(20级)" },
      { id: 533, name: "芒砀山", extension: "(30级)" }
    ],
    "pid:302": [ // 洛阳子区域
      { id: 285, name: "官渡", extension: "(40级)" },
      { id: 286, name: "虎牢关", extension: "(50级)" },
      { id: 333, name: "乌巢", extension: "(80级)" },
      { id: 337, name: "函谷关", extension: "(55级)" }
    ],
    "pid:304": [ // 长安子区域
      { id: 303, name: "华山", extension: "(90级)" },
      { id: 311, name: "潼关", extension: "(75级)" },
      { id: 414, name: "五丈原", extension: "(65级)" }
    ],
    "pid:70": [ // 成都子区域
      { id: 93, name: "落凤坡", extension: "(30级)" },
      { id: 112, name: "广汉", extension: "(40级)" },
      { id: 113, name: "峨眉山", extension: "(50级)" }
    ],
    "pid:111": [ // 南中子区域
      { id: 52, name: "云南", extension: "(60级)" },
      { id: 143, name: "泸水", extension: "(70级)" },
      { id: 351, name: "西洱湖", extension: "(80级)" }
    ],
    "pid:117": [ // 汉中子区域
      { id: 306, name: "子午谷", extension: "(90级)" },
      { id: 307, name: "街亭", extension: "(100级)" },
      { id: 308, name: "上方谷", extension: "(120级)" }
    ],
    "pid:154": [ // 建业子区域
      { id: 267, name: "广陵", extension: "" }
    ],
    "pid:212": [ // 长沙子区域
      { id: 220, name: "巴陵", extension: "" },
      { id: 221, name: "洞庭湖", extension: "" },
      { id: 222, name: "湘水", extension: "(130级)" }
    ],
    "pid:264": [ // 江陵子区域
      { id: 137, name: "麦城", extension: "(140级)" },
      { id: 161, name: "长坂坡", extension: "(140级)" },
      { id: 163, name: "夷陵", extension: "" }
    ]
  }
};

// 提取所有需要的ID和城市名
const requiredIds = new Set();
const cityNameToId = new Map();
const idToCityName = new Map();

// 从1418指令中提取
Object.values(standardData["1418"]).forEach(areas => {
  areas.forEach(area => {
    requiredIds.add(area.id);
    cityNameToId.set(area.name, area.id);
    idToCityName.set(area.id, area.name);
  });
});

// 从1436指令中提取
Object.values(standardData["1436"]).forEach(areas => {
  areas.forEach(area => {
    requiredIds.add(area.id);
    cityNameToId.set(area.name, area.id);
    idToCityName.set(area.id, area.name);
  });
});

console.log('🔍 标准数据格式分析结果:\n');

console.log('📋 需要的ID列表:');
console.log(Array.from(requiredIds).sort((a, b) => a - b).join(', '));

console.log('\n📋 城市名到ID的映射:');
cityNameToId.forEach((id, name) => {
  console.log(`  ${name} -> ID: ${id}`);
});

console.log('\n📋 ID到城市名的映射:');
idToCityName.forEach((name, id) => {
  console.log(`  ID: ${id} -> ${name}`);
});

console.log('\n📊 统计信息:');
console.log(`  总需要的ID数量: ${requiredIds.size}`);
console.log(`  城市名数量: ${cityNameToId.size}`);

// 导出数据供其他脚本使用
module.exports = {
  standardData,
  requiredIds: Array.from(requiredIds),
  cityNameToId,
  idToCityName
}; 